package com.prs.crm.domain.pm;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.FlowEntity;
import com.prs.crm.domain.doc.Document;

@Entity
@Table(name="pm_stage")
public class PmStage extends FlowEntity{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;	
	private String title;
	@ManyToOne
	private PmProject project;
	@ManyToOne
	private PmGroup pmGroup;
	private Double sepuence;
	private String state;
	@Lob
	private String summary;
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach;
	private Date startTime;
	private Date endTime;
	private Date constraintDate;
	private Double budget;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="stage")
	private Set<Document> docs;
	@ManyToOne
	private PmStage upStage;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="upStage")
	private Set<PmStage> children;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="srcPmStage")
	private Set<PmRelatStage> relatStages;
	@ManyToOne
	private PmStageType type;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public PmProject getProject() {
		return project;
	}
	public void setProject(PmProject project) {
		this.project = project;
	}

	public Double getSepuence() {
		return sepuence;
	}
	public void setSepuence(Double sepuence) {
		this.sepuence = sepuence;
	}

	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public void setBudget(Double budget) {
		this.budget = budget;
	}
	public Double getBudget() {
		return budget;
	}
	public void setDocs(Set<Document> docs) {
		this.docs = docs;
	}
	public Set<Document> getDocs() {
		return docs;
	}
	public PmStage getUpStage() {
		return upStage;
	}
	public void setUpStage(PmStage upStage) {
		this.upStage = upStage;
	}
	public Set<PmStage> getChildren() {
		return children;
	}
	public void setChildren(Set<PmStage> children) {
		this.children = children;
	}
	public void setRelatStages(Set<PmRelatStage> relatStages) {
		this.relatStages = relatStages;
	}
	public Set<PmRelatStage> getRelatStages() {
		return relatStages;
	}
	public void setConstraintDate(Date constraintDate) {
		this.constraintDate = constraintDate;
	}
	public Date getConstraintDate() {
		return constraintDate;
	}
	public void setPmGroup(PmGroup pmGroup) {
		this.pmGroup = pmGroup;
	}
	public PmGroup getPmGroup() {
		return pmGroup;
	}
	public void setType(PmStageType type) {
		this.type = type;
	}
	public PmStageType getType() {
		return type;
	}
}
